/*
 * @Author: adolphus adolphus520@163.com
 * @Date: 2022-12-11 22:29:08
 * @LastEditors: 姚杰鸿
 * @LastEditTime: 2025-01-23 15:50:56
 * @Description: file content
 */
import req from "@/lib/axios";

export const RoleApi = (info: string, attr: boolean) =>
  req({
    url: `/role${info}`,
    method: "get",
    headers: {
      "q-attr-info": attr ? "1" : "",
    },
  });

export const GetRoleApi = (code: string) =>
  req({
    url: `/role/${code}`,
    method: "get",
  });

export const IsValidRoleCodeApi = (id: number, code: string) =>
  req({
    url: `/role/valid/${id}/${code}`,
    method: "get",
  });

export const RolePostApi = (role: any) =>
  req({ url: "/role", method: "post", data: role });

export const RoleDeleteApi = (role: any) =>
  req({ url: `/role/${role.code}`, method: "delete" });

export const RoleUserDeleteApi = (role: any, user: any) =>
  req({ url: `/role/user/${role.code}/${user.account}`, method: "delete" });

export const RoleUserPutApi = (role: any, users: any[]) =>
  req({
    url: `/role/user/${role.code}`,
    method: "put",
    data: users,
  });
